import Vue from 'vue'
import Vuex from 'vuex'
import { setItem, getItem } from '@/utils/storage.js'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 存token
    tokenInfo: getItem('tokenInfo') || {}
  },
  mutations: {
    setTokenInfo (state, tokenObj) {
      state.tokenInfo = tokenObj
      // 存入localstorage
      setItem('tokenInfo', tokenObj)
    }
  },
  actions: {
  },
  modules: {
  }
})
